<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>主页面</title>
    <link rel="stylesheet" type="text/css" href="../../css/easyui/default/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/easyui/icon.css" />
    <link rel="stylesheet" type="text/css" href="../../css/ztree/zTreeStyle.css" />
    <link rel="stylesheet" type="text/css" href="../../css/self/main.css" />
    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/self/util.js"></script>
    <script type="text/javascript" src="../../js/self/ws.js"></script>
    <script type="text/javascript" src="../../js/self/menu.js"></script>
    <script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../js/easyui/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../../js/ztree/jquery.ztree.core.min.js"></script>
    <script type="text/javascript" src="../../js/ztree/jquery.ztree.exhide.min.js"></script>
    <script type="text/javascript">

        //写在外面供子窗口调用打开一个新面板
        function open(text, url) {
            if ($("#tabs").tabs('exists', text)) {
                $('#tabs').tabs('select', text);
            } else {
                var content = '<div style="width:100%;height:100%;overflow:hidden;">'
                    + '<iframe src="'
                    + url
                    + '" scrolling="auto" style="width:100%;height:100%;border:0;" oncontextmenu = "return false"></iframe></div>';

                $('#tabs').tabs('add', {
                    title : text,
                    content : content,
                    //href : url,
                    closable : true
                });
            }
        }

        $("document").ready(function(){
            //加载基本功能树
            var setting = {
                view: {
                    dblClickExpand: true,
                    showLine: true,
                    selectedMulti: false
                },
                data: {
                    simpleData: {
                        enable:true
                    }
                },
                callback: {
                    onClick: onClick
                }
            };
            $("#div_logout").click(function(){
                location.href = "/employee/logout";
            });
            var menu = [];
            var role = '[[${session.loginer.role}]]'
          if (role == 'admin') {
            menu = menuList.system
          } else if (role == 'assetManager') {
            menu = menuList.assetAdmin
          } else {
            menu = menuList.tester
          }
            $.fn.zTree.init($("#systemTree"), setting, menu);
            function onClick(event, treeId, treeNode, clickFlag){
                if(treeNode.page){
                    open(treeNode.name, treeNode.page);
                }
            }
        });
    </script>
</head>
<body class="easyui-layout" oncontextmenu = "return false">
<div data-options="region:'north',border:false" style="height:80px;padding:10px;background:url('/images/header_bg.png') no-repeat right; overflow: hidden;">
    <div id="sessionInfoDiv" style="position: absolute;right: 5px;top:10px;">
        [<strong th:text="${session.loginer.name}"></strong>]，欢迎你！
    </div>
    <div style="position: absolute; right: 5px; bottom: 10px; ">
        <a href="javascript:void(0);" class="easyui-menubutton"
           data-options="menu:'#div_controlPanel',iconCls:'icon-help'">控制面板</a>
    </div>
    <div id="div_controlPanel" style="width: 100px; display: none;">
        <div id="div_logout">退出系统</div>
    </div>
</div>
<div data-options="region:'west',split:true,title:'菜单导航'" style="width:200px">
    <div class="easyui-accordion" fit="true" border="false">
        <div title="系统管理" data-options="iconCls:'icon-mini-add'" style="overflow:auto">
            <ul id="systemTree" class="ztree"></ul>
        </div>
    </div>
</div>
<div data-options="region:'center'">
    <div id="tabs" fit="true" class="easyui-tabs" border="false" oncontextmenu = "return false">

    </div>
</div>
<div data-options="region:'south',border:false"
     style="height:50px;padding:10px;background:url('/images/header_bg.png') no-repeat right;">
    <table style="width: 100%;">
        <tbody>
        <tr>
            <td style="width: 50%;">
                <div style="color: #999; font-size: 8pt;"></div>
            </td>
            <td style="width: 50%;" class="co1">
                    <span id="span_online" style="background: url(/images/online.png) no-repeat
                    left;padding-left:18px;margin-left:3px;font-size:8pt;color:#005590;"></span>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>
